import {createRouter, createWebHashHistory} from 'vue-router'

//静态路由
// 定义静态路由
const staticRoutes = [
    {
        path: '/login',
        name: "Login",
        component: () => import("@/views/Login.vue"),
        meta: {
            authorityName: "登录"
        }
    },
    {
        path: '/',
        name: "Main",
        component: () => import("@/views/Main.vue"),
        children: [
            {
                // vue-router中params传参的方式(/:xxx),xxx可以是任意的值,404配置的时候
                // 一般都叫做pathMatch或catchAll
                path: '/:catchAll(.*)',
                component: () => import("@/components/error/error.vue"),
                meta: {
                    authorityName: "找不到了"
                }
            }
        ],
        meta: {
            authorityName: "首页"
        }
    },
    {
        path: '/redirect/:originalPath(.*)',
        component: () => import("@/components/RedirectSelf.vue")
    }
]

const router = createRouter({
    history: createWebHashHistory(),
    routes: staticRoutes
})

export default router